<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Yolo</title>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/css/common.css" />
    <script type="text/javascript">
      var channelToken = "{ChannelToken|html}";
    </script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    <script type="text/javascript" src="/yolo/yolo-token.js"></script>
    <script src="/scripts/yolo.js" type="text/javascript"></script>
  </head>
<body style="padding-top:60px" onload="onload()">
<div class="topbar">
  <div class="topbar-inner">
    <div class="container-fluid">
      <a class="brand" href="/">Yolo</a>
      <ul class="nav" data-bind="template: {name:'viewListTemplate', foreach:views}"></ul>
      <ul class="nav">
        <li><a href="http://code.google.com/p/yolo">About</a></li>
      </ul>
      <p class="pull-right" data-bind="template: {name:'loginNavigateTemplate'}"></p>
    </div>
  </div>
</div>

<div class="container-fluid">
<div id="tree-status" class="loading"></div>

<div id="ajax-result" class="ajax-result hide">
  <p id="ajax-result-body"></p>
</div>

  <div class="sidebar">
    <h2>Project global activities</h2>
    <div><a href="#" data-bind="click: function() {
          yoloViewModel.selectViewAndUser('Issues', 'ALL');
        }">Recent Issues</a></div>
    <div><a href="#" data-bind="click: function() {
          yoloViewModel.selectViewAndUser('Activities', 'ALL');
        }">Recent Activities</a></div>

    <h2>See someone's activity</h2>
    <div><form data-bind="submit: function() {
          var account = document.getElementById('account').value;
          if (account) {
            if (account.indexOf('@') < 0) {
              account += '@chromium.org'
            }
            yoloViewModel.selectViewAndUser('Activities', account);
          }
        }">
	<input type="text" name="account" id="account"></input>
      </form>
      </div>

    <div class="adminonly hide" data-bind="visible: userData() && userData().IsAdmin">
      <h2>Admin links</h2>
      <div><a href="/admin">/admin</a></div>
      <div><a data-bind="visible: userData() && userData().IsDevAppServer" href="/admin/console/">/admin/console/</a></div>
      <hr>
      <div data-bind="template: {name:'adminLinksTemplate', foreach:adminLinks()}"></div>
    </div> <!-- adminonly -->
  </div>

  <div class="content">
    <div class="content-pagedata-loader loading"></div>
    <div class="content-pagedata hide">

      <p data-bind="template: {name:'subHeaderTemplate'}"></p>

      <div data-bind="visible: selectedView() == 'Home' && !isLoggedIn()">
        <h3>Please login to see your timeline!</h3>
      </div>

      <!-- UserSummary -->
      <div class="user-summary" data-bind="visible: pageData().UserSummary">
        <div class="tmpl-generated-contents user-summary-body" data-bind="template: {name:'userSummaryTemplate'}"></div>
      </div>

      <!-- view = Activities|Home -->
      <div class="activities" data-bind="visible: selectedView() == 'Home' || selectedView() == 'Activities'">
        <p data-bind="visible: pageData().Activities.length == 0">No activities found.</p>
        <div class="tmpl-generated-contents" data-bind="template: {name:'activitiesTemplate'}"></div>
      </div>

      <!-- view = Issues -->
      <div class="issues" data-bind="visible: selectedView() == 'Issues'">
        <div data-bind="visible: pageData().Issues.length == 0">No issues found.</div>
        <div class="tmpl-generated-contents" data-bind="template: {name:'issuesTemplate'}"></div>
      </div>

      <div class="pagination" data-bind="template: {name:'pagerTemplate'}"></div>

    </div>
  </div> <!-- content -->
</div> <!-- content-fluid -->

<!-- templates -->
<script type="text/x-jquery-tmpl" id="viewListTemplate">
  <li data-bind="css:{active:$data == yoloViewModel.selectedView()}">
  <a href="#" data-bind="click: function(){yoloViewModel.selectViewAndUser($data, '')}">${$data}</a>
  </li>
</script>

<script type="text/x-jquery-tmpl" id="loginNavigateTemplate">
  <span data-bind="visible: isLoggedIn()">
    Logged in as ${userData() && userData().Email}
    <button class="btn" onclick="location.href='${userData() && userData().LogoutURL}'">Logout</button>
  </span>
  <span data-bind="visible: !isLoggedIn() && userData()">
    Please login to see your timeline
    <button class="btn primary" onclick="location.href='${userData() && userData().LoginURL}'">Login</button>
  </span>
</script>

<script type="text/x-jquery-tmpl" id="adminLinksTemplate">
  <a href="${URL}" onclick="${OnClick}">${Anchor}</a><br />
</script>

<script type="text/x-jquery-tmpl" id="subHeaderTemplate">
  {{if selectedView() == 'Activities' && pageData().Request && pageData().Request.User && pageData().Request.User.length > 0 && pageData().Request.User != 'ALL'}}
  <p class="alternate-view-navigation" onclick="yoloViewModel.selectViewAndUser('Issues', '${pageData().Request.User}')">${pageData().Request.User}'s <b>recent issues</b> &rArr;</p>
  {{else}}
  {{if selectedView() == 'Issues' && pageData().Request && pageData().Request.User && pageData().Request.User.length > 0 && pageData().Request.User != 'ALL'}}
  <p class="alternate-view-navigation" onclick="yoloViewModel.selectViewAndUser('Activities', '${pageData().Request.User}')">${pageData().Request.User}'s <b>recent activities</b> &rArr;</p>
  {{/if}}
  {{/if}}
  <h4>${pageData().SubHeader}</h4>
</script>

<!-- UserSummary -->
<script type="text/x-jquery-tmpl" id="userSummaryTemplate">
  <div class="user-file-detail hide" id="file-UserSummary"></div>
  <p>
  {{if pageData().UserSummary && pageData().UserSummary.FileCommits.length > 0}}

  <div class="heatgraph hide" id="user-heatgraph" onclick="$(this).fadeOut('fast')">
    <canvas id="heatgraph-canvas" width="800" height="600"></canvas>
  </div>

  <div>What files <b>${displayUser}</b> is touching
    {{if pageData().UserSummary.FileCommits.length > 5}}
    (<span class="clickable" onclick="yolo.showHeatGraph('#user-heatgraph', 'heatgraph-canvas', yoloViewModel.pageData().UserSummary.FileCommits)">heatgraph</span>){{/if}}:

  </div>
    <ul class="file-list">
      {{each pageData().UserSummary.FileCommits}}
        {{if $index < 10}}
        <li>
        <span style="background:${$value.color}">&nbsp;</span>
        <a href="#" onclick="yolo.loadFile(arguments[0], '.user-file-detail', '#file-UserSummary', '${$value.Key}')">${Key}</a>
         {{/if}}
      {{/each}}
    </ul>
  {{/if}}

  {{if pageData().UserSummary && pageData().UserSummary.RelatedUsers.length > 0}}
  <div>Who's closely working with <b>${displayUser}</b>:</div>
    <ul>
      {{each pageData().UserSummary.RelatedUsers}}
      <li>
      <span style="background:${$value.color}">&nbsp;</span>
      <a href="#" onclick="yoloViewModel.selectViewAndUser('Activities', '${$value.Key}')">${$value.Key}</a>
      {{/each}}
    </ul>
  {{/if}}
  </p>
</script>


<!-- Activities -->
<script type="text/x-jquery-tmpl" id="activitiesTemplate">
{{each pageData().Activities}}
<div id="activity-${$index}" class="activity ${Type} non-expanded {{if Issue != ''}}expandable{{/if}}" onclick="yolo.loadIssue(${$index}, '${Issue}')">
<div>
  <b>${Type}</b>
    <a href="${URL}" target="_new"><img src="/css/new_window_icon.gif" /></a>
  by <a href="#" onclick="yoloViewModel.selectViewAndUser('Activities', '${User}')"><b>${User}</b></a>
{{if Issue > 0}}
  on issue ${Issue}
{{/if}}
  posted ${yolo.epochToHowLongAgo(Time)}
  <!--<g:plusone href="${URL}" size="small"></g:plusone> -->
</div>
<div>
  ${Snippet}
</div>
<div class="activity-detail hide" id="activity-detail-${$index}"></div>
</div>
{{/each}}
</script>

<!-- Issues -->
<script type="text/x-jquery-tmpl" id="issuesTemplate">
{{each pageData().Issues}}
  <div href="#" id="issue-item-${IssueId}"
    class="issue-item {{if Closed}}closed{{/if}}
    {{if selectedIssue() == $value.IssueId}}expanded{{else}}non-expanded{{/if}}"
    onclick="yolo.loadIssueDetail('${SiteURL}', '${IssueId}')">
    <div>
      <b>Issue ${IssueId}: ${Subject}</b> {{if Closed}} (Closed) {{/if}}
        &nbsp; <a href="http://${SiteURL}/${IssueId}" target="_new"><img src="/css/new_window_icon.gif" />Open issue page</a>
    </div>
    <div>
      by <a href="#" onclick="yoloViewModel.selectViewAndUser('Issues', '${OwnerEmail}')">${OwnerEmail}</a>,
      modified ${yolo.epochToHowLongAgo(Modified)} </div>
     <div id="issue-detail-${IssueId}" class="issue-detail hide"
      style="overflow:hidden">
     </div>
    </div>
{{/each}}
</script>

<!-- Issue -->
<script type="text/x-jquery-tmpl" id="issueTemplate">
  <div class="issue-details" style="overflow:hidden">
    <div>
      <b>Issue ${Issue.IssueId}: ${Issue.Subject}</b> {{if Issue.Closed}} (Closed) {{/if}}
      &nbsp; <a href="http://${Issue.SiteURL}/${Issue.IssueId}" target="_new"><img src="/css/new_window_icon.gif" />Open issue page</a>
    </div>
    <div>
      by <a href="#" onclick="yoloViewModel.selectViewAndUser('Issues', '${Issue.OwnerEmail}')">${Issue.OwnerEmail}</a>,
      modified ${yolo.epochToHowLongAgo(Issue.Modified)} </div>
    <div><b>Modified:</b> ${yolo.epochToHowLongAgo(Issue.Created)} (${yolo.epochToLocalDate(Issue.Created)})</div>
    <div><b>Created:</b> ${yolo.epochToHowLongAgo(Issue.Created)} <span class="issue-date">(${yolo.epochToLocalDate(Issue.Created)})</span></div>
{{if IssueDetail.Reviewers.length > 0}}
    <div>
    <b>Reviewers:</b>
    {{each IssueDetail.Reviewers}}
    <a href="#" onclick="yoloViewModel.selectViewAndUser('Activities', '${$value}')">${$value}</a>{{if $index < IssueDetail.Reviewers.length - 1}}, {{/if}}
    {{/each}}
    </div>
{{/if}}
{{if IssueDetail.Files.length > 0}}
    <b>Files:</b>
    <div class="issue-file-detail hide" id="file-${Issue.IssueId}"></div>
    <ul class="file-list">
      {{each IssueDetail.Files}}
      <li> <span href="#" onclick="yolo.loadFile(arguments[0], '#file-${Issue.IssueId}', '.issue-file-detail', '${$value}')">${$value}</span>
      {{/each}}
    </ul>
{{/if}}
    <div>
      <dl style="margin-bottom:5px">
        <dt>Description:</dt>
        <dd>
        <div class="issue-full-description">
        {{html yolo.breakLine(IssueDetail.FullDescription)}}
        </div>
        </dd>
      </dl>
    </div>
  </div>
</script>

<!-- File -->
<script type="text/x-jquery-tmpl" id="fileTemplate">
  <p class="file-detail-close" onclick="yolo.closeDiv(arguments[0], '${Div}')">x</p>
  <div class="file-detail-path">${Path}:</div>
  <ul>
  {{if ActiveUsers.length == 0}}
    No data found.
  {{else}}
    <li>Who's recently touching this file:
    <ul>
      {{each ActiveUsers}}
      <li>
      <span style="background:${$value.color}">&nbsp;</span>
      <a href="#" onclick="yoloViewModel.selectViewAndUser('Activities', '${$value.Key}')">${$value.Key}</a>
      {{/each}}
    </ul>
  {{/if}}
  </ul>
</script>

<!-- Pager -->
<script type="text/x-jquery-tmpl" id="pagerTemplate">
<div class="pagination">
  <ul>
    <li class="prev {{if yoloViewModel.selectedPage() == '1'}}disabled{{/if}}"><a href="#"
      {{if selectedPage() != '1'}}
      onclick="yoloViewModel.selectPage(${pageData().Request.Page} - 1);
      {{/if}}">&larr; Prev</a></li>
    <li class="active"><a href="#" onclick="">${pageData().Request.Page}</a></li>
    <li class="next {{if !pageData().HasMore}}disabled{{/if}}"><a href="#"
      {{if pageData().HasMore}}
      onclick="yoloViewModel.selectPage(${pageData().Request.Page} + 1);
      {{/if}}">Next &rarr;</a></li>
  </ul>
</div>
</script>

<!-- scripts -->
<script src="/scripts/jquery.tmpl.min.js" type="text/javascript"></script>
<script src="/scripts/jquery.address-1.4.min.js" type="text/javascript"></script>
<script src="/scripts/knockout.js" type="text/javascript"></script>
<script src="/scripts/knockout.address.js" type="text/javascript"></script>
<script type="text/javascript" src="/scripts/yolo-after.js"></script>
<script type="text/javascript" src="/scripts/heatgraph.js"></script>
<script type="text/javascript" src="/_ah/channel/jsapi"></script>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
</body>
</html>
